/*
 * MetadataBlock.h
 *
 *  Created on: Jul 7, 2009
 *      Author: elkobir
 */

#ifndef METADATABLOCK_H_
#define METADATABLOCK_H_

#include <iostream>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <vector>
#include <sstream>
#include "Utils.h"
#include <math.h>
#include "Log.h"
using namespace std;

class MetadataBlock {
private:
	int _freeBlocksCount;
	int _freeINodeCount;
public:

	MetadataBlock(unsigned char* data);
	MetadataBlock(int dataBlockSize, int numberOfInodes, unsigned long int diskSize);

	virtual ~MetadataBlock();

	int _fileSystemSizeInBlocks;
	int _blockSizeInBytes;
	int _rootINode;
	int _lastFreeBlockOffset;
	int _lastFreeBlockBlock;
	int _totalINodeCount;
	int _lastFreeINodeOffset;
	int _lastFreeINodeBlock;

	unsigned char* toBytes();
	int getAddressInBlockCount();
	int getSuperBlocksPlusINodeArrayBlocksCount();
	int incFreeInodeCount();
	int decFreeInodeCount();
	int getFreeInodeCount();

	int incFreeBlocksCount();
	int decFreeBlocksCount();
	int getFreeBlocksCount();


};

#endif /* METADATABLOCK_H_ */
